Wiki

Clone wiki

GhToGhx / Batch Script

Home | Console | Batch Script | Commands | <<Prev | Next>>

The GhToGhx tool can be called from a bat-file and the batch example below demonstrates how to apply the commands.

Fig 1. Illustrated are two batch commands executed: X = Convert To Ghx and Z = Compress to GZip.

CommandLine Convert To Ghx.PNG

List of Commands

See a separate page for a listing of all available commandline parameters.

Batch Mode

Below a list of commands that can be run in batch (or manually via the Console as pictured above). What this tool and do is, it:

  1. Converts all .gh files in a specified folder and its sub-folders to ghx format and places them in a temp folder (...\_ghx) under the respective files' path. (cmd X) This folder can then be removed using the cmd R if the ghx files aren't needed anymore. If the .gh file has a twin .ghx file it will not be converted. No original files are changed, ever.
  2. Compresses all .gh files in a given folder and its sub-folders into GZip format (filename .ghx.gz) and places them in a temp folder (...\_gzip) under respective .gh files' path. (cmd Z) This folder can then be removed if the ghx file isn't needed anymore.
  3. Lists all Grasshopper related files and folders and saves the name lists into logfiles on disk. (cmd g, x, z and d)
  4. Deletes all Converted (cmd R) and Compressed files (cmd r) and corresponding temp-folders. Again, no original files are touched modifed or removed.
  5. Deletes the log files created by this tool (only). (cmd C)

Replace all the paths inside the bat-file with your own:

REM ----------------------------------------------------------------------------------------
REM     Prefix "+" means verbose (console display)
REM     Prefix "-" means !verbose (no or very little console display)
REM     Postfix "L" means = Do log to file
REM     g means List regular .gh files
REM     X means Convert to .ghx (xml) format
REM     x means List ghx files
REM     Z means Compress to .ghx.gz  (GZip) format
REM     z means List compressed files
REM     d means List temp directories for ghx and gzip files
REM     C means Clear Logfiles from disk
REM     ? Postfix Promt, pauses the batch execution at that line and prompts for a key press
REM ----------------------------------------------------------------------------------------

REM - LOG regular Grasshopper files (.gh)
.\ghtoghx.exe D:\DEV\CAD\GH\GH_Workbench\\__ScriptComponents\ +gL

REM - CREATE Xml versions (ghx)
.\ghtoghx.exe D:\DEV\CAD\GH\GH_Workbench\\__ScriptComponents\ +XL

REM - CREATE compressed GZip versions (gzip)
.\ghtoghx.exe D:\DEV\CAD\GH\GH_Workbench\\__ScriptComponents\ +ZL

REM - LOG ghx file-lists to disk
.\ghtoghx.exe D:\DEV\CAD\GH\GH_Workbench\\__ScriptComponents\ +xL

REM - LOG GZip file-lists to disk
.\ghtoghx.exe D:\DEV\CAD\GH\GH_Workbench\\__ScriptComponents\ +zL

REM - LOG Ghx and GZip foldername lists to disk
.\ghtoghx.exe D:\DEV\CAD\GH\GH_Workbench\\__ScriptComponents\ +dL

REM - REMOVE ghx folders and files ("L" doesn't play any role here)
.\ghtoghx.exe D:\DEV\CAD\GH\GH_Workbench\\__ScriptComponents\ +R

REM - REMOVE GZip folders and files
.\ghtoghx.exe D:\DEV\CAD\GH\GH_Workbench\\__ScriptComponents\ +r

REM - CLEAR Log files from disk
.\ghtoghx.exe D:\DEV\CAD\GH\GH_Workbench\\__ScriptComponents\ +C?

Updated